package f;

import com.huawei.hms.aaid.constant.AaidIdConstant;
import f.f0.l.c;
import g.h;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nullable;
import javax.net.ssl.SSLPeerUnverifiedException;

/* compiled from: CertificatePinner */
public final class e {
    public static final e c = new e(new LinkedHashSet(new ArrayList()), null);
    public final Set<a> a;
    @Nullable
    public final c b;

    /* compiled from: CertificatePinner */
    public static final class a {
        public boolean equals(Object obj) {
            if (!(obj instanceof a)) {
                return false;
            }
            Objects.requireNonNull((a) obj);
            throw null;
        }

        public int hashCode() {
            throw null;
        }

        public String toString() {
            new StringBuilder().append(null);
            throw null;
        }
    }

    public e(Set<a> set, @Nullable c cVar) {
        this.a = set;
        this.b = cVar;
    }

    public static String b(Certificate certificate) {
        if (certificate instanceof X509Certificate) {
            StringBuilder g = c.b.a.a.a.g("sha256/");
            g.append(h.m(((X509Certificate) certificate).getPublicKey().getEncoded()).d(AaidIdConstant.SIGNATURE_SHA256).a());
            return g.toString();
        }
        throw new IllegalArgumentException("Certificate pinning requires X509 certificates");
    }

    public void a(String str, List<Certificate> list) throws SSLPeerUnverifiedException {
        List emptyList = Collections.emptyList();
        Iterator it = this.a.iterator();
        if (it.hasNext()) {
            Objects.requireNonNull((a) it.next());
            throw null;
        } else if (!emptyList.isEmpty()) {
            List list2;
            String str2;
            c cVar = this.b;
            if (cVar != null) {
                list2 = cVar.a(list2, str);
            }
            int size = list2.size();
            int i = 0;
            int i2 = 0;
            while (i2 < size) {
                X509Certificate x509Certificate = (X509Certificate) list2.get(i2);
                if (emptyList.size() <= 0) {
                    i2++;
                } else {
                    Objects.requireNonNull((a) emptyList.get(0));
                    throw null;
                }
            }
            StringBuilder i3 = c.b.a.a.a.i("Certificate pinning failure!", "\n  Peer certificate chain:");
            int size2 = list2.size();
            i2 = 0;
            while (true) {
                str2 = "\n    ";
                if (i2 >= size2) {
                    break;
                }
                X509Certificate x509Certificate2 = (X509Certificate) list2.get(i2);
                i3.append(str2);
                i3.append(b(x509Certificate2));
                i3.append(": ");
                i3.append(x509Certificate2.getSubjectDN().getName());
                i2++;
            }
            i3.append("\n  Pinned certificates for ");
            i3.append(str);
            i3.append(":");
            int size3 = emptyList.size();
            while (i < size3) {
                a aVar = (a) emptyList.get(i);
                i3.append(str2);
                i3.append(aVar);
                i++;
            }
            throw new SSLPeerUnverifiedException(i3.toString());
        }
    }

    /* JADX WARNING: Missing block: B:8:0x001c, code skipped:
            if (r3.a.equals(r4.a) != false) goto L_0x0020;
     */
    public boolean equals(@javax.annotation.Nullable java.lang.Object r4) {
        /*
        r3 = this;
        r0 = 1;
        if (r4 != r3) goto L_0x0004;
    L_0x0003:
        return r0;
    L_0x0004:
        r1 = r4 instanceof f.e;
        if (r1 == 0) goto L_0x001f;
    L_0x0008:
        r1 = r3.b;
        r4 = (f.e) r4;
        r2 = r4.b;
        r1 = f.f0.c.m(r1, r2);
        if (r1 == 0) goto L_0x001f;
    L_0x0014:
        r1 = r3.a;
        r4 = r4.a;
        r4 = r1.equals(r4);
        if (r4 == 0) goto L_0x001f;
    L_0x001e:
        goto L_0x0020;
    L_0x001f:
        r0 = 0;
    L_0x0020:
        return r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: f.e.equals(java.lang.Object):boolean");
    }

    public int hashCode() {
        c cVar = this.b;
        return this.a.hashCode() + ((cVar != null ? cVar.hashCode() : 0) * 31);
    }
}
